Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix trailing newline in code blocks #113

Merged
merged 1 commit into from
Mar 18, 2024
Merged

Conversation

cpuguy83
Copy link
Owner

@cpuguy83 cpuguy83 commented Feb 5, 2024

Given this input:

some code

We were adding an additional newline character before the code close tag even though the code block by definition already includes that newline.

e.g., blackfriday is hadning us some code\n as the literal content of the code block.

fixes #47

".nh\n\n.EX\necho foo\n\n.EE\n",
".nh\n\n.EX\necho foo\n.EE\n",

// make sure we litteral new lines surrounding in the markdown block are preserved as they are intentional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/we litteral/the literal/

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@kolyshkin
Copy link
Contributor

Overall LGTM, but let me try that on some more inputs first.

@cpuguy83 cpuguy83 force-pushed the fix_codeblock_newline branch from d87a980 to d3d5f33 Compare February 5, 2024 04:20
@bartekpacia
Copy link

Hi! Thank you very much for this module. I'd like to ask when this PR will be merged?

@cpuguy83 cpuguy83 force-pushed the fix_codeblock_newline branch from d3d5f33 to 4ab80e5 Compare March 17, 2024 15:51
Given this input:

> ```
> some code
> ```

We were adding an additional newline character before the code close
tag even though the code block by definition already includes that
newline.

e.g., blackfriday is hadning us `some code\n` as the literal content of
the code block.

Signed-off-by: Brian Goff <[email protected]>
@cpuguy83 cpuguy83 force-pushed the fix_codeblock_newline branch from 4ab80e5 to fd6bc09 Compare March 17, 2024 15:53
Copy link
Collaborator

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cpuguy83 cpuguy83 merged commit 1e915fd into master Mar 18, 2024
5 checks passed
@cpuguy83 cpuguy83 deleted the fix_codeblock_newline branch March 18, 2024 16:03
@cpuguy83
Copy link
Owner Author

v2.0.4 includes this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Too many empty lines around code
4 participants